/*
 * Copyright (c) 2020 Fraunhofer FOKUS and others. All rights reserved.
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contact: mosaic@fokus.fraunhofer.de
 */
package org.eclipse.mosaic.lib.objects.vehicle;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.eclipse.mosaic.lib.geo.GeoPoint;
import org.eclipse.mosaic.lib.objects.UnitData;

/**
 * This class is used as a container for any carla vehicle data.
 */
public class CarlaVehicleData extends UnitData {

    private static final long serialVersionUID = 1L;

    private final Integer signals;

    private final Double heading;


    public CarlaVehicleData(long time, String name, GeoPoint position, Integer signals, Double heading) {
        super(time, name, position);
        this.signals = signals;
        this.heading = heading;
    }

    public Integer getSignals() {
        return signals;
    }

    public Double getHeading() {
        return heading;
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(3, 89)
                .append(heading)
                .append(signals)
                .toHashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        if (obj.getClass() != getClass()) {
            return false;
        }

        CarlaVehicleData other = (CarlaVehicleData) obj;
        return new EqualsBuilder()
                .append(this.heading, other.heading)
                .append(this.signals, other.signals)
                .isEquals();
    }

    @Override
    public String toString() {
        return "CarlaVehicleInfo{"
                + ", heading=" + this.heading
                + ", signals=" + this.signals
                + '}';
    }
}
